home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / stdio / tmpfile.c < prev    next >
C/C++ Source or Header  |  1997-09-09  |  496b  |  29 lines

  1.  
  2. /*
  3.  *  tmpfile()       - create a temporary file that is deleted on
  4.  *              close
  5.  *
  6.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  7.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  8.  *    DICE-LICENSE.TXT.
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15. FILE *
  16. tmpfile()
  17. {
  18.     char *name;
  19.     FILE *fi;
  20.  
  21.     if (name = strdup(tmpnam(NULL))) {
  22.     if (fi = fopen(name, "wb+C"))
  23.         return(fi);
  24.     free(name);
  25.     }
  26.     return(NULL);
  27. }
  28.  
  29.